package net.bwie.dt.funtion;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import net.bwie.dt.bean.ProductBean;
import org.apache.flink.api.common.functions.MapFunction;

import java.text.SimpleDateFormat;


public class dtBeanMapFuctionProduct implements MapFunction<String, ProductBean> {


    @Override
    public ProductBean map(String value) throws Exception {
        JSONObject jsonObject = JSON.parseObject(value);
        Integer produce_id = jsonObject.getInteger("produce_id");
        String produce_name = jsonObject.getString("produce_name");
        String ts = jsonObject.getString("ts");
        return new ProductBean(
                produce_id
                ,produce_name

                ,ts
        );
    }
}
